#pragma once

#include <vector>
#include "../txr_algo_dlm_cls/txr_algo_dlm_cls_define.h"
#include "common\define.h"
#include "NvInfer.h"
#include "cuda_img_resize.cuh"
#include "opencv2/opencv.hpp"
#include <opencv2\highgui.hpp>
#include <opencv2\imgproc.hpp>
namespace txr_algo_dlm_cls
{
	struct DetectRes2 
	{
		int classes;
		float prob;
	};

	class DlmClsV1
	{
	public:
		DlmClsV1();
		~DlmClsV1();
	
		bool Init(int gpu_id, const char* hdats_path);
		int BatchSize();
		void Detect(st_dlm_data* p_imgs, int num, std::vector<st_result_info> &v_results);

	private:
		void Reset();
		bool LoadEngine(std::vector<char> v_engine_data);
		std::vector<st_result_info> postProcess(st_dlm_data* p_imgs,  int num, float* output, const int& outSize);
		
		st_encrypt_info m_info;
		nvinfer1::ICudaEngine* m_engine = nullptr;
		nvinfer1::IExecutionContext* m_context = nullptr;
		std::vector<void*> m_v_dev_buffer;
		std::vector<int64_t> m_v_dev_buf_size;

		std::vector<std::vector<int>> m_grids;

		int m_out_size = 0;
		cudaStream_t m_stream;
		std::vector<float> m_v_out_buf;
		std::vector<st_cuda_resize_dev_space> _v_resize_space;
	};

}//namespace yolo_v6